home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2 Development Libraries
/
SGI IRIX 6.2 Development Libraries.iso
/
dist
/
complib.idb
/
usr
/
share
/
catman
/
p_man
/
cat3
/
complib
/
csfft1du.z
/
csfft1du
Wrap
Text File
|
1996-03-14
|
8KB
|
133 lines
ccccssssfffffffftttt1111dddduuuu,,,,zzzzddddfffffffftttt1111dddduuuu((((3333FFFF)))) ccccssssfffffffftttt1111dddduuuu,,,,zzzzddddfffffffftttt1111dddduuuu((((3333FFFF))))
NNNNAAAAMMMMEEEE
ccccssssfffffffftttt1111dddduuuu,,,, zzzzddddfffffffftttt1111dddduuuu ---- 1D, Complex to Real, Inverse Fast Fourier
Transforms.
SSSSYYYYNNNNOOOOPPPPSSSSYYYYSSSS
_F_o_r_t_r_a_n :
ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee ccccssssfffffffftttt1111dddduuuu(((( ssssiiiiggggnnnn,,,, nnnn,,,, aaaarrrrrrrraaaayyyy,,,, iiiinnnncccc,,,, ccccooooeeeeffffffff ))))
iiiinnnntttteeeeggggeeeerrrr ssssiiiiggggnnnn,,,, nnnn,,,, iiiinnnncccc
rrrreeeeaaaallll aaaarrrrrrrraaaayyyy((((0000::::((((2222****((((((((NNNN++++2222))))////2222))))----1111))))****iiiinnnncccc)))),,,, ccccooooeeeeffffffff((((nnnn++++11115555))))
ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee zzzzddddfffffffftttt1111dddduuuu(((( ssssiiiiggggnnnn,,,, nnnn,,,, aaaarrrrrrrraaaayyyy,,,, iiiinnnncccc,,,, ccccooooeeeeffffffff ))))
iiiinnnntttteeeeggggeeeerrrr ssssiiiiggggnnnn,,,, nnnn,,,, iiiinnnncccc
rrrreeeeaaaallll****8888 aaaarrrrrrrraaaayyyy((((0000::::((((2222****((((((((NNNN++++2222))))////2222))))----1111))))****iiiinnnncccc)))),,,, ccccooooeeeeffffffff((((nnnn++++11115555))))
_C :
####iiiinnnncccclllluuuuddddeeee <<<<fffffffftttt....hhhh>>>>
iiiinnnntttt ccccssssfffffffftttt1111dddduuuu (((( iiiinnnntttt ssssiiiiggggnnnn,,,, iiiinnnntttt nnnn,,,, ffffllllooooaaaatttt ****aaaarrrrrrrraaaayyyy,,,,
iiiinnnntttt iiiinnnncccc,,,, ffffllllooooaaaatttt ****ccccooooeeeeffffffff))));;;;
iiiinnnntttt zzzzddddfffffffftttt1111dddduuuu (((( iiiinnnntttt ssssiiiiggggnnnn,,,, iiiinnnntttt nnnn,,,, ddddoooouuuubbbblllleeee ****aaaarrrrrrrraaaayyyy,,,,
iiiinnnntttt iiiinnnncccc,,,, ddddoooouuuubbbblllleeee ****ccccooooeeeeffffffff))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
ccccssssfffffffftttt1111dddduuuu and zzzzddddfffffffftttt1111dddduuuu compute the real sequence of N samples, from its
Fourier transform. The i-th index f(i) of a sequence with Fourier
transform F(k) is equal to:
f(i) = Sum ( W^(i*k) * F(k) ), for k =0, ..., (N-1)
W = exp( (Sign*2*sqrt(-1)*PI) / N )
The Inverse Fourier transform is performed in-place, so the input Fourier
transform is overwritten by the final sequence output. As the output
sequence has real values, only the first half of the transform is needed.
The (N-k)-th sample of the transform would be the conjugate of the k-th
sample.
However, some extra space is necessary. For an N sample output sequence,
the input complex transform takes ((N+2)/2) complex values. This
represents either N+1(odd case) or N+2(even case) real values, that's one
or two more real values than the output real sequence.
PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
SSSSIIIIGGGGNNNN Integer specifying which sign to be used for the expression of W
(see above) - must be either +1 or -1.
Unchanged on exit.
NNNN Integer, the number of samples in each sequence.
Unchanged on exit.
PPPPaaaaggggeeee 1111
ccccssssfffffffftttt1111dddduuuu,,,,zzzzddddfffffffftttt1111dddduuuu((((3333FFFF)))) ccccssssfffffffftttt1111dddduuuu,,,,zzzzddddfffffffftttt1111dddduuuu((((3333FFFF))))
AAAARRRRRRRRAAAAYYYY Array containing the Fourier Transform.
On output, the element "i" of the real sequence is stored as A(i*inc) in
_F_o_r_t_r_a_n , and A[i*inc] in _C.
On exit, the array is overwritten by its transform.
IIIINNNNCCCC Integer, increment between two consecutive elements of a sequence.
Unchanged on exit.
CCCCOOOOEEEEFFFFFFFF Array of at least ( N + 15 ) elements. On entry it contains the
Sines/Cosines and factorization of N. COEFF needs to be initialized with
a call to scfft1dui or dzfft1dui.
Unchanged on exit.
EEEExxxxaaaammmmpppplllleeee ooooffff CCCCaaaalllllllliiiinnnngggg SSSSeeeeqqqquuuueeeennnncccceeee
Working on a sequences of 1024 real values. We successively apply a
Direct Fourier Transform, an Inverse Fourier Trasnform and finally scale
back the result by a factor 1/N (1/1024.)-
This sequence DirectFFT-InverseFFT-Scaling is equivalent to the identity
operator and the final sequence should be equal (with round-off
precision) to the initial sequence.
Elements of each sequence are stored with increment (stride) 1, and the
offset between the first element of two succesive sequence (leading
dimension) is 1026 (1026 >= 1024+2).
_F_o_r_t_r_a_n
real array(0:1026-1), coeff(1024+15)
call csfft1dui( 1024, coeff)
call csfft1du( -1, 1024, array, 1, coeff)
call scfft1du( 1, 1024, array, 1, coeff)
call sscal1d( 1024, (1./real(1024)), array, 1)
_C
#include <fft.h>
float array[1026], *coeff;
coeff = csfft1dui( 1024, NULL);
csfft1du( -1, 1024, array, 1, coeff);
csfft1du( 1, 1024, array, 1, coeff);
sscal1d( 1024, 1./(float)1024, array, 1);
NNNNOOOOTTTTEEEE____1111 :::: The Direct and Inverse transforms should use opposite signs -
Which one is used (+1 or -1) for Direct transform is just a matter of
convention-
NNNNOOOOTTTTEEEE____2222 :::: The Fourier Transforms are not normalized so the succession
Direct-Inverse transform scales the input data by a factor equal to the
size of the transform.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
fft, csfft1dui, zdfft1dui, scfft1du, dzfft1du, csfft1du, zdfft1du,
sscal1d, dscal1d
PPPPaaaaggggeeee 2222